﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Lotour.IBrand;

using Lucene.Net.Search;
using Lucene.Net.Documents;
using Lucene.Net.Index;

using Lotour.BrandEntity;


namespace Lotour.BrandSearch
{
  public  class LineSearchForA:IndexSearch
    {
        protected override object CreateQuery(IndexSearcher search, object obj)
        {
           
            List<BaseLineIdModel> list=new List<BaseLineIdModel> ();

            Hits hit = search.Search(Query);

            ARegionAndLine LuceneModel = new ARegionAndLine();
           
            for (int i = 0; i < hit.Length(); i++)
            {
                Document doc = hit.Doc(i);
                BaseLineIdModel m = new BaseLineIdModel();
                m.AboutSight=doc.Get("AboutSight").Tolist();
                m.DayNumber=Convert.ToInt32(doc.Get("DayNumber"));
                m.DestCity = doc.Get("DestCity").Tolist();
                m.EntId = Convert.ToInt32(doc.Get("EntId"));
                m.Festival = doc.Get("Festival").Tolist();
                m.Id = Convert.ToInt32(doc.Get("Id"));
                m.Level = Convert.ToInt32(doc.Get("Level"));
                m.LineMode = doc.Get("LineMode").Tolist();
                m.Price = Convert.ToInt32(doc.Get("Price"));
                m.SSite = Convert.ToInt32(doc.Get("SSite"));
                m.Star = Convert.ToInt32(doc.Get("Star"));
                m.Type = Convert.ToInt32(doc.Get("Type"));
                m.OrderCount = Convert.ToInt32(doc.Get("OrderCount"));
                m.RefreshDate = DateTime.Parse(doc.Get("RefreshDate"));
                list.Add(m); 

               
            }
            return list;


        }

        public override object Search()
        {
            List<ARegionAndLine> list = new List<ARegionAndLine>();
            return ToSearch(list);
        }
    }
}
